home *** CD-ROM | disk | FTP | other *** search
- Path: airdmhor.gen.nz!not-for-mail
- From: gumboot@airdmhor.gen.nz (Simon Hosie)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: New printf - like function, is it possible?
- Followup-To: comp.lang.c,comp.lang.c++
- Date: 15 Feb 1996 04:39:05 +1300
- Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
- Message-ID: <4fsvmp$esi@airdmhor.gen.nz>
- References: <4eqb3a$2r5@pan.otol.fi>
- NNTP-Posting-Host: airdmhor.gen.nz
- X-Newsreader: TIN [version 1.2 PL2]
-
- Timo Sakari:
- > However, I want to write a "better" printing function, where string to be
- > formed doesn't need to be formatted first, it can be displayed and formed
- > at the same time in the same syntax like printf, something like these:
-
-
- #include <stdarg.h>
-
- typeA PrintfToWin(typeB x, const char *Format, ...)
- {
- TypeA ReturnVal;
- const char Buffer[1025];
- va_list ArgPtr;
-
- va_start(ArgPtr, Format);
- vsprintf(Buffer, Format, ArgPtr);
- va_end(ArgPtr);
-
- reutrn PutsToWin(DEBUG_WIN_1, Buffer);
- }
-
- Does that look like what you want?
-